//
//  PartinActivityTableViewCell.m
//  YIJU2.0HD
//
//  Created by 张金国 on 16/5/24.
//  Copyright © 2016年 Mr.X. All rights reserved.
//

#import "PartinActivityTableViewCell.h"
#import "Masonry.h"


@interface PartinActivityTableViewCell ()

@property (nonatomic ,strong)UIView  *containerView;

@property (nonatomic ,strong)UILabel  *tagLabel;

@property (nonatomic ,strong)UILabel  *describeLabel;

@end

@implementation PartinActivityTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupConstraint];
        self.contentView.backgroundColor = [UIColor whiteColor];
    }
    return self;
}

- (void)setupConstraint {
    
    [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView);
    }];
    
    
    [self.tagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.containerView.mas_top).offset(20);
        make.bottom.equalTo(self.containerView.mas_bottom).offset(-20);
        make.left.equalTo(self.containerView.mas_left).offset(10);
        make.width.equalTo(@40);
    }];
    
    
    [self.describeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.containerView.mas_top).offset(10);
        make.bottom.equalTo(self.containerView.mas_bottom).offset(-10);
        make.left.equalTo(self.tagLabel.mas_right).offset(10);
        make.right.equalTo(self.containerView.mas_right).offset(10);
    }];
    
}

#pragma mark - getter
- (UIView *)containerView {
    if (!_containerView) {
        _containerView = [[UIView alloc]init];
        [self.contentView addSubview:_containerView];
    }
    return _containerView;
}

- (UILabel *)tagLabel {
    if (!_tagLabel) {
        _tagLabel = [[UILabel alloc]init];
        _tagLabel.layer.masksToBounds = YES;
        _tagLabel.layer.cornerRadius = 5.0f;
        _tagLabel.layer.borderWidth = 1.0f;
        _tagLabel.layer.borderColor = [UIColor greenColor].CGColor;
        _tagLabel.text = @" 团购  ";
        [self.containerView addSubview:_tagLabel];
    }
    return _tagLabel;
}

- (UILabel *)describeLabel {
    if (!_describeLabel) {
        _describeLabel = [[UILabel alloc]init];
        _describeLabel.numberOfLines = 0;
        [self.containerView addSubview:_describeLabel];
    }
    return _describeLabel;
}


- (void)setModel:(PartinActivityCellModel *)model {
    _model = model;
    self.describeLabel.text = model.describe;
}

@end
